<?php
###############   COPYLEFT GPLv3 LICENSE   ###############
##
## JFX Version 0.2.9
## Website Management Software
## www.jfxcms.com
##
## Copyright 2009 GPLv3 - http://www.opensource.org/licenses/gpl-3.0.html
##
## Anthony Gallon
## oi_antz@hotmail.com
##
## Permission is hereby granted to any person having a copy of this software
## to freely use and modify as required so long as the copyright notices
## and branding remain intact.
##
## Full license details available at http://www.jfxcms.com/license
##
###############   COPYLEFT GPLv3 LICENSE   ###############


$menu = $params['menu'];

if($this->checkPermission('perm_manage_files') || $this->checkPermission('perm_manage_images')){

    $websiteContent = $menu->findRecursive('website-content');

    if(!is_object($websiteContent) || false === ($websiteContent instanceof JFX_Theme_Menu)){
        $websiteContent = $menu->addItem(count($menu->getItems()), 'website-content', $this->lang('website_content'));
    }

    $filesFolders = $websiteContent->addItem(count($websiteContent->getItems()), 'file-management', $this->lang('file_folders'));

    if($this->checkPermission('perm_manage_files')){
        // manage files
        $url = $CONFIG->adminUrl.'/file-manager/';
        $icon = $CONFIG->imageUrl.'/admin/icons/folder.png';
        $i = $filesFolders->addItem(0, 'file-manager', $this->lang('file_manager'), $url, $icon);
    }

    if($this->checkPermission('perm_manage_images')){
        // manage images
        $url = $this->adminUrl.'/browse/';
        $icon = $CONFIG->imageUrl.'/admin/icons/image.png';
        $i = $filesFolders->addItem(2, 'image-manager', $this->lang('image_manager'), $url, $icon);
    }



}